home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / awksrc.zip / MISSING / STRERROR.C < prev    next >
C/C++ Source or Header  |  1991-10-16  |  1KB  |  41 lines

  1. /*
  2.  * strerror.c --- ANSI C compatible system error routine
  3.  */
  4.  
  5. /* 
  6.  * Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc.
  7.  * 
  8.  * This file is part of GAWK, the GNU implementation of the
  9.  * AWK Progamming Language.
  10.  * 
  11.  * GAWK is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  * 
  16.  * GAWK is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  * 
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with GAWK; see the file COPYING.  If not, write to
  23.  * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25.  
  26. extern int sys_nerr;
  27. extern char *sys_errlist[];
  28.  
  29. char *
  30. strerror(n)
  31. int n;
  32. {
  33.     static char mesg[30];
  34.  
  35.     if (n < 0 || n > sys_nerr) {
  36.         sprintf (mesg, "Unknown error (%d)", n);
  37.         return mesg;
  38.     } else
  39.         return sys_errlist[n];
  40. }
  41.